//
//  MainTabBarButton.m
//  MyMovie
//
//  Created by apple on 16/5/10.
//  Copyright © 2016年 ljp. All rights reserved.
//

#import "MainTabBarButton.h"

@implementation MainTabBarButton

+ (instancetype)mainTabBarButtonWithImage:(UIImage *)image Title:(NSString *)title Frame:(CGRect)frame {


    MainTabBarButton *button = [MainTabBarButton buttonWithType:UIButtonTypeCustom];
    button.frame = frame;

    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
    imageView.image = [image copy];
    imageView.center = CGPointMake(button.frame.size.width/2, button.center.y-10);
    //拉伸模式
    imageView.contentMode = UIViewContentModeScaleAspectFit;

    UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(0, button.frame.size.height*0.7, button.frame.size.width, button.frame.size.height*0.3)];
    lable.text = title;
    lable.font = [UIFont systemFontOfSize:12];
    lable.textAlignment = NSTextAlignmentCenter;
    lable.textColor = [UIColor whiteColor];

    [button addSubview:imageView];
    [button addSubview:lable];

    return button;
}

@end
